﻿using System;
using System.Data;
using System.Configuration;

using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using System.Data.SqlClient;

/// <summary>
/// Descripción breve de product
/// </summary>
public class product
{
    int product_id;
    string name;
    string description;
    double client_fee;
    double vendor_fee;
    int address;
	public product()
	{
        product_id = 0;
        name = "";
        description = "";
        client_fee = 0.0;
        vendor_fee = 0.0;
        address = 0;
	}
    public static double findClientFee(string pproduct){
        double result;
        result = 0.0;
         SqlConnection conn = null;
        
        SqlDataAdapter sqladapt;
        DataSet ds = new DataSet();
        DataTable dt = new DataTable();
        conn = DB.OpenConnection();
        string strsql = "select client_fee from product where product_id='"+pproduct+"'";
        sqladapt= new SqlDataAdapter(strsql, conn);
        sqladapt.Fill(ds,"producto");
        dt = ds.Tables["producto"];
        if (dt.Rows.Count == 0)
        {
            result = 0;
        }
        else {
            foreach (DataRow fila in dt.Rows) { 
                result= double.Parse(fila["client_fee"].ToString());
            
            }
        }
        return result;
        
    }

}
